package com.bblei.designpatterndemo.strategypattern;

import com.bblei.designpatterndemo.strategypattern.duck.Duck;
import com.bblei.designpatterndemo.strategypattern.duck.RedHeadDuck;
import com.bblei.designpatterndemo.strategypattern.flybehavior.NoFlyBehavior;

public class StimulateDuck {
    public static void main(String[] args) {

        Duck mRedHeadDuck = new RedHeadDuck();


//
        mRedHeadDuck.display();//子类的重写父类的特有方法  每个子类可以分别实现 不同的操作
        mRedHeadDuck.Fly();//策略方法 可以根据对象的特性去封装对应接口的实现类
//        mRedHeadDuck.Quack();
        mRedHeadDuck.swim();//父类的公共方法 子类的共同属性
//        mRedHeadDuck.display();
        mRedHeadDuck.SetFlyBehavoir(new NoFlyBehavior());//可以动态的去 改变策略行为
//        mRedHeadDuck.Fly();
////        mRedHeadDuck.SetQuackBehavoir(new NoQuackBehavior());
//        mRedHeadDuck.Quack();
    }
}
